/****************************************************************************************
**  File: Segment2.hpp
**  Author: Asteroth
**  Date: 5-mag-2009
****************************************************************************************/

#ifndef __SEGMENT2_HPP__
#define __SEGMENT2_HPP__

template <typename T>
class Segment2x {
public:
	Vector2x<T> A, B;

	Segment2x():														A(0, 0), B(0, 0) {}
	Segment2x(const Segment2x<T> &segm):								A(segm.A), B(segm.B) {}
	Segment2x(const Vector2x<T> &pointA, const Vector2x<T> &pointB):	A(pointA), B(pointB) {}
	Segment2x(T aX, T aY, T bX, T bY):									A(aX, aY), A(bX, bY) {}

	/// Distance between point A and B.
	inline T length() const {
		T x = A.X - B.X;
		T y = A.Y - B.Y;
		return sqrt(x*x + y*y);
	}
};

typedef Segment2x<float> Segment2;

#endif
